package Example17;
class Animal{
    public void shout(){
        System.out.println("叽喳~叽喳~叽喳");
    }
}
class Dog extends Animal {
    public void eat(){
        System.out.println("咩~咩~咩");
    }
    public void ea(){
        System.out.println("吃一双蚂蚁");
    }
}

public class Exa17 {
    public static void main (String[] args) {
        Animal a1 = new Dog();
        System.out.println("insstanceof判断a1是否来自动物类" + (a1 instanceof Animal));
        System.out.println("insstanceof判断a1是否来自动物类" + (a1 instanceof Dog));
        Animal a2 = new Animal();
        System.out.println("insstanceof判断a2是否来自动物类" + (a2 instanceof Animal));
        System.out.println("insstanceof判断a2是否来自动物类" + (a2 instanceof Dog));
    }
}
